package com.example.JavaConcurrent.Project3_Phaser.forceTermination;

import java.util.concurrent.Phaser;

/**
 * getPhase()获取已经到达的第几个屏障
 */
public class ThreadA extends Thread {
    private Phaser phaser;

    public ThreadA(Phaser phaser){
        this.phaser = phaser;
    }

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName()+"A1 begin at"+System.currentTimeMillis());
        phaser.arriveAndAwaitAdvance();//屏障点1
        System.out.println(Thread.currentThread().getName()+"A1 end at"+System.currentTimeMillis());
    }
}
